<template>
  <!-- 省市区县 -->
  <div>
    <a-select :allowClear="allowClear" show-search :value="fromCityList"  
    :default-active-first-option="false" 
    :show-arrow="false" 
    :filter-option="false" 
    :not-found-content="null" 
    @search="handleSearch"
    @change="handleChangeSearch">
    <a-select-option v-for="d in searchdata" :key="d.value">{{ d.text }}</a-select-option>
   </a-select>
  </div>
</template>
<script>
import { getContractNameSelect } from '@/api/video'
export default {

  props:['fromCityList'], 
  data() {
    return {
      cityList:[],
      searchvalue: '',
      searchdata: [],
      allowClear:true,
    }
  },
  created(){
  
  },
  mounted() {
  },
  methods: {
    returnBackFn(e) {
      this.$emit('update',e)
    },
    
    handleSearch(value) {
     
      getContractNameSelect(value,'')
        .then((response) => {
          this.searchdata = []
          for (var i = 0; i < response.data.length; i++) {
            let linshi = {}
            linshi.text = response.data[i].contractName
            linshi.value = i
            linshi.contractNo = response.data[i].contractNo
            this.searchdata.push(linshi)
          }
        })
        .catch((error) => {})
    },
    handleChangeSearch(value) {
     if(value==undefined){
    
     }else{    
      let name = this.searchdata[value].text
      let contractNo = this.searchdata[value].contractNo
      this.$emit('update',name,contractNo)
       
     }


 
    },
  },
}
</script>

<style scoped>
</style>
